package YOONA;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

//@WebServlet("/A")
public class A extends GenericServlet {

    public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {

        response.setContentType("text/html");
        PrintWriter writer = response.getWriter();

        ServletConfig servletConfig = this.getServletConfig();
        System.out.println(servletConfig);
        writer.print(servletConfig);
        String servletName = servletConfig.getServletName();
        ServletContext servletContext = servletConfig.getServletContext();
        Enumeration<String> initParameterNames = servletConfig.getInitParameterNames();
        while (initParameterNames.hasMoreElements()) {
            String initParameterName = initParameterNames.nextElement();
            String val = servletConfig.getInitParameter(initParameterName);
            System.out.println(initParameterName+val);
        }
        Enumeration<String> initParameterNames1 = this.getInitParameterNames();
        while(initParameterNames1.hasMoreElements()){
            String initParameterName = initParameterNames1.nextElement();
            String val = this.getInitParameter(initParameterName);
            System.out.println(initParameterName+val);

        }
        System.out.println(servletContext);
        System.out.println(servletConfig);

    }
}
